<template>
  <section v-if="row && fieldName">
    {{ row[fieldName] ?  formatNumber(row[fieldName]) : 0 }}
  </section>
</template>

<script>
export default {
  name: "ThousandthPercentile",
  props: {
    row: {
      type: Object,
      default: () => { }
    },
    fieldName: {
      type: String,
      default: ""
    }
  },
  computed: {
    formatNumber () {
      return num => num ? Number(num).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,') : 0;
    }
  }
};
</script>
